<?php
	// Start the session
	session_start();

	//create a database connection.
	require_once("../includes/db_connect.php");
	require_once("pageList.php");
	require_once("../includes/pageRights.php");
	require_once("pageList.php");
	require_once("../includes/login_functions.php");
	handleLogin($db);
	require("../includes/whichpage.php");
	$page = whichPage();
	
	
	require_once("../includes/leftlist.php");
	
	
	$rights = getRights($db);
	
	$requestURI = explode("=", $_SERVER["REQUEST_URI"]);
	$page = "start";
	if(sizeof($requestURI) > 1) {
		$page = $requestURI[1];
	}
	
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<meta charset="utf-8">
</head>
<body>
<div id="banner">
	<a class="ajaxLink" href="?site=start">
		<img src="images/banner.png" alt="">
	</a>
	
	<div id="bannerMenu">
		<div id="bannerMenuLeft">
			<div class="bannerLinks"><?php if(canSeeAdmin($db)) echo "<a class=\"ajaxLink\" id=\"admin\" href=\"?page=admin\">Admin</a>"?></div>
			<div class="bannerLinks"></div>
			<div class="bannerLinks"><a class="ajaxLink" id="profile" href="?page=profile">Min Profil</a></div>
		</div>
		<div id="bannerMenuRight">
			<div class="bannerLinks">Inloggad som: <?php echo $_SESSION["firstname"]." ".$_SESSION["lastname"];?></div>
			<div class="bannerLinks"><a href="index.php?logout=true" >Logga ut</a></div>
			<div class="bannerLinks"><a class="ajaxLink" id="about" href="?page=about" >Om JENSEN online</a></div>
		</div>
	</div>
</div>

<div id="topMenu">
	<a class="topMenuLinks ajaxLink" id="start" href="?page=start">Nyheter</a>
	<a class="topMenuLinks ajaxLink" id="myclass" href="?page=myclass">Min Klass</a>
	<a class="topMenuLinks ajaxLink" id="courses" href="?page=courses">Utbildning</a>
	<a class="topMenuLinks ajaxLink" id="messages" href="?page=messages">Meddelanden</a>
	<a class="topMenuLinks ajaxLink" id="results" href="?page=results">Studieresultat</a>
</div>

<div id="leftMenu">
	<div id="menuPage">
		<p id="leftListTop">
		<?php 	
			echo getTopPage($db, $page);
		?></p>
	</div>
		<!-- START OF MENU HERE -->
    <ul id="leftList" class="nav ">
		<?php 
			createList($page, $db);
		?>
	</ul>
		
		<!-- END OF MENU HERE -->
</div>

<div id="contentAreaWrapper">
	<div id="contentArea">
		<div id="realContent">
			<?php
				include("../includes/content.php");
			?>
		</div>
	</div>
</div>

<script src="script/jquery-1.11.1.min.js"></script>
<script src="script/jsfunctions.js"></script>
<script src="script/home.js"></script>
<script src="script/ajaxlinks.js"></script>

</body>
</html>